package statemachine.fsm;

import org.apache.commons.lang3.RandomUtils;

public class IdleState extends AbstractState {
    @Override
    void init() {

    }

    @Override
    boolean checkPrecondition() {
        return true;
    }

    @Override
    ObjectBehaveStateEnum doUpdate() {
        // 如果有人在范围
        int i = RandomUtils.nextInt(0, 100);
        LOGGER.info("巡逻中。。。{}", i);
        if (i > 50) {
            return ObjectBehaveStateEnum.PURSUIT_STATE;
        } else {
            return ObjectBehaveStateEnum.IDLE_STATE;
        }
    }
}
